package com.haynes.meetxiaohai.common;

/**
 * 给线程设置一个当前用户的ID值
 * @Author Haynes
 * @Date 2023/3/20 9:15
 * @PackageName:com.haynes.reggie.common
 * @ClassName: BaseContext
 */
public class BaseContext {
    private static final ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    /**
     * 设置用户的ID
     * @param id
     */
    public static void setCurrent(Long id){
        threadLocal.set(id);
    }

    /**
     * 获取用户的ID
     * @return
     */
    public static Long getCurrent(){
        return threadLocal.get();
    }
}
